package org.groupg.practice.jscience;

import org.jscience.mathematics.function.Polynomial;
import org.jscience.mathematics.number.Real;

public class JScienceMathDemo {
    public static void main(String[] args) {
        // 定义多项式 f(x) = 2x^2 + 3x + 5
        Polynomial<Real> poly = Polynomial.valueOf(
            Real.valueOf(2l),
            Real.valueOf(3l),
            Real.valueOf(5l)
        );

        // 计算 f(2)
        Real result = poly.evaluate(Real.valueOf(2));
        System.out.println("f(2) = " + result); // 输出: 19.0
    }
}